<%@page import="java.util.List"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html>
<%@ include file="/WEB-INF/view-system/include/contentTaglib.jsp"%>

<html>
<head>
<title>codeInfo</title>
	<script src="${ctxStaticSystem }/js/roleGroup/roleGroup.js" type="text/javascript" ></script>
	<link href="${ctx}/static-system/css/staff/staff.css" rel="stylesheet" type="text/css"/>
	 <link href="${ctxStaticSystem }/css/roleManage/roleManage.css" rel="stylesheet" type="text/css"/>
</head> 
<body>
<tags:dataSet id="roleGroupInfo">
	<tags:dataField name="group_id" visiable="false" display="资源组ID"/>
	<tags:dataField name="group_name" display="资源组名称" sort="false"  cssClass="table-header-center" width="25%"/>
	<tags:dataField name="status" display="状态" visiable="true" sort="false" width="25%" cssClass="table-header-center"/>
	<tags:dataField name="flag" display="是否拥有全部角色" sort="false" width="25%" cssClass="table-header-center"/>
	<tags:dataField name="create_time" display="创建时间" sort="false" visiable="true" width="25%" cssClass="table-header-center"/>
	<tags:dataField name="roleGroup_operation" display="操作" sort="false" width="25%" cssClass="table-header-center"/>
</tags:dataSet>

<tags:ajax id="queryRoleGroupListAjax" url="${ctx}/roleGroup/listAll" type="post"
	contentType="application/x-www-form-urlencoded" formQuery="#groupQueryFrm" formSubmit="true"
	autoSend="false"/>
<tags:ajax id="deleteGroupsAjax" autoSend="false" type="post"
	url="${ctx }/roleGroup/delete" 
	contentType="application/x-www-form-urlencoded" onSuccess="RoleGroupPage.onDeleteInfoSucc"/>		
 
	<!-- 修改页面dialog -->
	<tags:dialog id="roleGroupEditDialog" width="800px" >
		<link href="${ctxStaticSystem }/css/knowledge/manage/knowledge.css" rel="stylesheet" type="text/css"/>
		<script src="${ctxStaticSystem }/js/roleGroup/roleGroup.js" type="text/javascript" ></script>
		<!-- 角色表查询 -->
		<tags:ajax id="queryRoleInfoListAjax"
		url="${ctx }/system/role/roleList" autoSend='false' type='post'
		formSubmit="true" formQuery="#roleOldInfoFrm"/>
		<!-- 查询已有角色 -->
		<tags:ajax id="findRoleGroupHasRolesAjax" url="${ctx }/roleGroup/listRolesById"
			autoSend="false" type="post" contentType="application/x-www-form-urlencoded"
			onSuccess="RoleGroupPage.onFindRolesSucc"/>
		<!-- 保存角色组的信息 -->
		<tags:ajax id="saveStaffRolesAjax" url="${ctx }/roleGroup/saveRolegroup"
			 autoSend="false" type="post" formQuery="#rolegroupBaseInfoFrm" formSubmit="true"
			 onSuccess="RoleGroupPage.onSaveGroupSucc"/>
		<tags:dataSet id="roleInfoSet">
			<tags:dataField sort="false" name="role_id" display="" visiable="false" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="role_name" display="角色名称" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="state" display="状态" cssClass="table-header-center"/>
			<tags:dataField sort="false" name="role_type" display="操作" cssClass="table-header-center"/>
		</tags:dataSet>
		
		<tags:dialogHeader title="资源组信息修改"/>
		<tags:dialogBody>
			<form id="rolegroupBaseInfoFrm" class='m-cust'>
				<input name="group_id" style="display:none" id="group_id">
				<input name="roleIds" id="groupHasRoles" style="display:none">
				<div class='row form-group'>
					<div class="col-md-6">
						<div class="col-md-3 col-sm-3">
							<label for='roleGroupEdit_groupName' class='m-label'>资源组名称:</label>
						</div>
						<div class="col-md-9 col-sm-9">
							<input name="group_name" id="roleGroupEdit_groupName" class="form-control m-input" maxlength="20">
						</div>
					</div>
					<div class="col-md-6">
						<div class="col-md-3 col-sm-3">
							<label class='m-label' for="roleGroupEdit_status">状态：</label>
						</div>
						<div class="col-md-9 col-sm-9">
							<select name="status" class="form-control m-input" id="roleGroupEdit_status">
								<option value="1">启用</option>
								<option value="0">禁用</option>
							</select>
						</div>
					</div>
				</div>
				<div class='row form-group'>
					<div class='col-md-6 col-sm-6'>
						<div class='col-md-3 col-sm-3'>
							<label class='m-label' for='roleGroupEdit_flag'>拥有所有角色：</label>
						</div>
						<div class='col-md-9 col-sm-9'>
							<select name="flag" class="form-control m-input" id="roleGroupEdit_flag" onchange="RoleGroupPage.onFlagSelected(this)">
								<option value="0" selected="selected">否</option>
								<option value="1">是</option>
							</select>
						</div>
					</div>
				</div>
			</form>
			<div class="hasRolesDiv col-md-12" data-role-management='true'>
				<form action="" id="hasRolesFrm">
					<fieldset>
						<legend>已拥有角色</legend>
						<div class="rolesShowDiv">
						
						</div>
					</fieldset>
				</form>
			</div>
			<div class="col-md-12" data-role-management='true'>
				<form action="" id="roleOldInfoFrm">
					<fieldset>
						<legend>所有角色</legend>
						<div class='form-group'>
							<div class="input-group col-md-6">
								<input id="searchRole" type="text" name="role_name" class="form-control" placeholder="角色名称">
				  				<span class="input-group-btn">
								    <button class="btn btn-primary m-btn" type="submit" onclick="RoleGroupPage.searchByroleName()">搜索</button>
								</span>
							</div>
						</div>
						<div>
							<tags:datatable id="roleXDatatable" storage="false"
								ajax="queryRoleInfoListAjax" pagination="roleManaXPagination"
								dataSet="roleInfoSet" automatic="false"
								striped="true" cutLine="true"
								onRenderItem="RoleGroupPage.onRoleGroupRenderItem"
								afterReady="RoleGroupPage.onAfterReady" />
							<tags:pagination pageSize="5" id="roleManaXPagination" 
								pageChoice="5" datatable="roleXDatatable" />
						</div>
					</fieldset>
				</form>
		 	</div>
		</tags:dialogBody>
		<tags:dialogFooter>
			<button class="btn btn-primary m-btn" id="saveChanges" onclick="RoleGroupPage.saveAllRoleGroup()">保存</button>
			<button class="btn btn-default m-btn" data-dismiss='modal'>关闭</button>
		</tags:dialogFooter>
	</tags:dialog>
	
<tags:boards>
	<tags:board boardTitle="资源组信息" width="100%">
		<form id="groupQueryFrm">
			<div class="col-md-4">
				<div class="col-md-3 item">
					<label >创建时间：</label>
				</div>
				<div class="col-md-9">
					<tags:datepicker dateFormat="yyyy-MM-dd" name="createTime"
						dateType="date" id="createTime" className="form-control speclDate"/>
				</div>
			</div>
			<div class="col-md-4">
				<div class="col-md-3 item">
				  	<label>资源组名称：</label>
				</div>
				<div class="col-md-9">
					<input name="group_name" class="form-control" id="group_name" type="text">
				</div>
			</div>	
			<div class="col-md-4">
				<div class="col-md-2 item">
					<label >状态：</label>
				</div>
				<div class="col-md-9">
					<select name="status" class="form-control" id="status">
					 <option value="">请选择</option>
						<option value="1">启用</option>
						<option value="0">禁用</option>
					</select>
				</div>
			</div>	
		<div class="roleGroupBtnArea col-md-12" style="margin-top:1em;margin-bottom:1em;">
			<button class="btn btn-primary m-btn" onclick="RoleGroupPage.query()">查询</button>
			<button class="btn btn-default m-btn" type="reset">重置</button>
			<button class="btn btn-success m-btn" onclick="RoleGroupPage.addRoleGroup()">新增</button>
			<button class="btn btn-warning m-btn" onclick="RoleGroupPage.deleteGroups()">批量删除</button>
			<button class="btn btn-info m-btn" onclick="RoleGroupPage.refreshTable()">刷新</button>
		</div>
		<div data-tag="资源组列表" class="form-horizontal">
			<tags:datatable id="gruopInfoXDataTable" storage="false"  
				ajax="queryRoleGroupListAjax" dataSet="roleGroupInfo" 
				pagination="groupInfoXPagination" striped="true" checkable="true"
				afterReady="RoleGroupPage.onGroupInfoDatatableAfterReady"
				single="false" cutLine="true"  onRenderItem="RoleGroupPage.onRenderGroupItem"/>
			<tags:pagination pageSize="10" id="groupInfoXPagination" 
				pageChoice="10" datatable="gruopInfoXDataTable"/>	
			</div>
		</form>	 
	</tags:board>
</tags:boards>
</body>
	
</html>